<?php echo $form->create('Phicdsv');?>
<table>
  <tr>
    <td><?php echo $form->input('namhoc',array('id'=>'namhoc','label'=>'Năm học:','type'=>'select','options'=>$namhocs,'selected'=>$namhoc_id));?></td>
    <td><?php echo $form->end(' Thực hiện ');?></td>
  </tr>
</table>
<h2>Chi tiết thu chi năm học</h2>
<table id='tables'>
<tr>
<th></th>
<?php foreach ($result as $value):?>
<th><?php echo $value['thang']?></th>
<?php endforeach;?>
</tr>
<tr>
<td>Phí thu</td>
<?php foreach ($result as $value):?>
<td><?php echo number_format($value['phithu'],0,2,'.');?></td>
<?php endforeach;?>
</tr>
<tr>
<td>Phí chi</td>
<?php foreach ($result as $value):?>
<td><?php echo number_format($value['phichi'],0,2,'.');?></td>
<?php endforeach;?>
</tr>
</table>

<?php
		echo $flashChart->begin();  
        $flashChart->setTitle('Biểu đồ Thu - Chi');
        $flashChart->setData($result);
        $flashChart->setLabelsPath( 'default.{n}.thang' );
        $flashChart->setLegend('y','Số tiền');
        $flashChart->setLegend('x','Tháng');
        //phi thu
        $flashChart->setNumbersPath( '{n}.phithu' );
        $flashChart->axis('y',array('range' => array(0,$max + $max/5,$max/5)));
        $flashChart->axis('x',array('tick_height' => 5,'3d' =>5));
        echo $flashChart->chart('bar_glass');
        $flashChart->setNumbersPath( '{n}.phichi' );
        echo $flashChart->chart('bar_glass',array('colour'=>'#D33D08'));	
        echo $flashChart->render(800,500);
?>
<br>
<?php echo $html->image('../img/col_blue.png').': Tiền thu';?>
<br>
<?php echo $html->image('../img/col_orange.png').': Tiền chi';?>